// V-backend/src/routes/activities.js
const express = require('express');
const router = express.Router();
const activityController = require('../controllers/activityController');
const { auth } = require('../middleware/auth');  // 修复这里

// 公开路由
router.get('/', activityController.getActivities);
router.get('/:id', activityController.getActivityById);

// 需要认证的路由
router.post('/', auth, activityController.createActivity);
router.put('/:id', auth, activityController.updateActivity);
router.post('/register', auth, activityController.registerActivity);
router.delete('/registration/:activity_id', auth, activityController.cancelRegistration);
router.get('/my-registrations', auth, activityController.getUserRegistrations);

module.exports = router;